/**
 * Created by JuntaoYi
 * Date 2020/3/31
 */
let API_DOMAIN = '/api/';

if (process.env.NODE_ENV === 'production') {
    API_DOMAIN = 'http://www.1lantech.com:52000/';
} else {
    API_DOMAIN = 'http://test.1lantech.com:52000/';
}

export const API_CODE = {
    // API请求正常
    OK: '200',
    // API请求正常，数据异常
    ERR_DATA: '403',
    // API请求正常，空数据
    ERR_NO_DATA: '301',
    // API请求正常，登录异常
    ERR_LOGOUT: '401'
}

// API请求异常
export const API_FAILED = '网络连接异常，请稍后再试';
export const API_LOGOUT = '您的账号已在其他设备登录，请重新登录';

export const API_LIST = {
    // 获取数据
    GET_DATA: API_DOMAIN + 'getData',
    wxParams: {
        path: API_DOMAIN + 'getData',
        method: 'GET'
    },
    login: {
        path: API_DOMAIN + 'manager/login',
        method: 'POST'
    },
    exit: {
        path: API_DOMAIN + '/loginout',
        method: 'GET'
    },
    menu: {
        delete: {
            path: API_DOMAIN + 'sys/menu?id={id}',
            method: 'DELETE'
        },
        tree: {
            path: API_DOMAIN + 'sys/menu/treelist?type={type}',
            method: 'GET'
        },
        detail: {
            path: API_DOMAIN + 'sys/menu?id={id}',
            method: 'GET'
        },
        list: {
            path: API_DOMAIN + 'sys/menu/list?parentId={parentId}',
            method: 'GET'
        },
        edit: {
            path: API_DOMAIN + 'sys/menu',
            method: 'put'
        },
        add: {
            path: API_DOMAIN + 'sys/menu',
            method: 'POST'
        },
        checkName: {
            path: API_DOMAIN + 'sys/menu/checkMenuName?menuName={menuName}&menuType={menuType}&id={id}',
            method: 'GET'
        }
    }
}
